package kr.co.graviti.service.pr;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
@SuppressWarnings("unchecked")
public class PRServiceImp implements PRService {
	@Autowired
	private SqlMapClientTemplate sqlMapClientTemplate;
	
	/* return type 수정 */
	@Override
	public int commBoard_insert(HashMap<String, Object> param){
		return (Integer)this.sqlMapClientTemplate.insert("pr.commBoard_insert", param);
	}
	
	@Override
	public void commBoard_update(HashMap<String, Object> param){
		this.sqlMapClientTemplate.update("pr.commBoard_update",param);
	}
	
	@Override
	public void commBoard_delete(HashMap<String, Object> param){
		this.sqlMapClientTemplate.update("pr.commBoard_delete",param);
	}
	
	@Override
	public int totalcnt(HashMap<String, Object> param){
		return (Integer)this.sqlMapClientTemplate.queryForObject("pr.totalcnt",param);
	}
	
	@Override
	public List<HashMap<String, Object>> boardPagingList(HashMap<String, Object> param){
		return (List<HashMap<String,Object>>)this.sqlMapClientTemplate.queryForList("pr.boardPagingList",param);
	}
	@Override
	public HashMap<String, Object> boardView(HashMap<String, Object> param){
		return (HashMap<String, Object>)this.sqlMapClientTemplate.queryForObject("pr.boardView", param);
	}

	@Override
	public void sponInsert(HashMap<String, Object> param){
		this.sqlMapClientTemplate.update("pr.sponInsert",param);
	}
	
	@Override
	public void sponUpdate(HashMap<String, Object> param){
		this.sqlMapClientTemplate.update("pr.sponUpdate",param);
	}
	
	@Override
	public int selectMaxThreadidxOfList(HashMap<String, Object> param){
		return (Integer)this.sqlMapClientTemplate.queryForObject("pr.selectMaxThreadidxOfList",param);
	}
	
	
	
}
